package com.ruoyi.server.api.imguser.mapper;

import com.ruoyi.server.api.imguser.pojo.ImgUser;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


@Mapper
public interface ImgUserMapper {

    /**
     * @param userId 为主键
     * @Author wsb
     * @Description 123
     * @Date 2024/11/15 10:33
     * @Return 返回查询的用户信息
     **/
    @Select("select * from img_users where user_id = #{userId} limit 1")
    ImgUser selectUserById(String userId);

    /**
     * @param user
     * @return
     */
    @Insert("insert into img_users(user_id,nick_name) values(#{userId},#{nickName})")
    int insertImgUser(ImgUser user);

    int updateUserByUserId(ImgUser user);

    /**
     * @param phone
     * @Author Lx
     * @Description 判断手机号是否已经存在
     * @Date 2024/11/19 9:04
     * @Return com.ruoyi.common.core.domain.AjaxResult
     */
    @Select("select * from img_users where phone=#{phone}")
    ImgUser getPhone(String phone);

     /**
    * @Author 帅
    * @Description 使用手机号查询头像地址
    * @Date 2024/11/22 14:17
    * @Return 头像地址
    * @param userId 用户手机号
    */
     @Select("select avatar_url from img_users where phone=#{userId}")
    String getUserAvatarUrl(String userId);
}
